/**
 * 
 */
package com.nervytech.tutorcruise.profile.beans.builders;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.nervytech.tutorcruise.db.dao.model.TrainerProfile;
import com.nervytech.tutorcruise.db.service.interfaces.ITrainerProfileService;
import com.nervytech.tutorcruise.profile.beans.TrainerProfileBean;
import com.nervytech.tutorcruise.profile.beans.UserBean;
import com.nervytech.tutorcruise.service.exception.TrainerCruiseServiceException;

/**
 * @author ADMIN
 * 
 */
@Component("trainerProfileBeanBuilder")
public class TrainerProfileBeanBuilder implements IProfileBeanBuilder {

	@Autowired
	private ITrainerProfileService trainerProfService;

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.nervytech.tutorcruise.profile.beans.builders.IProfileBeanBuilder#
	 * getProfileBean()
	 */
	@Override
	public Object getProfileBean(long userId)
			throws TrainerCruiseServiceException {

		System.out.println("TRAINERPROFILE SERVICEEEEEEEEEEEEEEE "
				+ trainerProfService);

		TrainerProfile trainerProfile = trainerProfService
				.getTrainerProfile(userId); 

		return trainerProfile;
	}

	@Override
	public <T extends UserBean> T getProfileBeanG(long userId)
			throws TrainerCruiseServiceException {
		
		System.out.println("TRAINERPROFILE SERVICEEEEEEEEEEEEEEEGGGGGGGGGGGGGGGGG "
				+ trainerProfService);

		
		TrainerProfile trainerProfile = trainerProfService
				.getTrainerProfile(userId);

		TrainerProfileBean profileBean = new TrainerProfileBean();
		profileBean.setAchievementSummary(trainerProfile.getAchievementSummary());
		profileBean.setBlogs(trainerProfile.getBlogs());
		profileBean.setCategory(trainerProfile.getCategory());
		profileBean.setCertification(trainerProfile.getCertification());
		profileBean.setCity(trainerProfile.getCity());
		profileBean.setContactNumber(trainerProfile.getContactNumber());
		profileBean.setEduSummary(trainerProfile.getEduSummary());
		profileBean.setEmail(trainerProfile.getEmail());
		profileBean.setFacebookUrl(trainerProfile.getFacebookUrl());
		profileBean.setFullName(trainerProfile.getFullName());
		profileBean.setGoogleplusUrl(trainerProfile.getGoogleplusUrl());
		profileBean.setImageUrl(trainerProfile.getImageUrl());
		profileBean.setIsPortalCertified(trainerProfile.getIsPortalCertified());
		profileBean.setIsTechCertified(trainerProfile.getIsTechCertified());
		profileBean.setLinkedinUrl(trainerProfile.getLinkedinUrl());
		profileBean.setProfessionalSummary(trainerProfile.getProfessionalSummary());
		profileBean.setProfExperience(trainerProfile.getProfExperience());
		profileBean.setRating(trainerProfile.getRating());
		profileBean.setSkillSummary(trainerProfile.getSkillSummary());
		profileBean.setSpecialises(trainerProfile.getSpecialises());
		profileBean.setTaggedSkills(trainerProfile.getTaggedSkills());
		profileBean.setTeachingExperience(trainerProfile.getTeachingExperience());
		profileBean.setTechingSummary(trainerProfile.getTechingSummary());
		profileBean.setTwitterUrl(trainerProfile.getTwitterUrl());
		profileBean.setUserId(userId);
		
		return (T)profileBean;
	}

}
